const Sequelize = require('sequelize')
const sequelize = require('../mysql')
const Project = require('./projectModel')
class Module extends Sequelize.Model {}
Module.init({
  projectId: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    allowNull: false
  },
  id: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    autoIncrement: true,
    unique: true,
    primaryKey: true
  },
  name: Sequelize.STRING(20),
  thumbnail: Sequelize.STRING(255),
  packageUrl: Sequelize.STRING(255)
}, { sequelize, modelName: 'module' })
Module.belongsTo(Project, { foreignKey: 'projectId', targetKey: 'id' })
module.exports = Module
